<!--
 * @Descripttion: 
 * @Author: bjp
-->
<template>
    <div class="shopDetais">
        <div class="banner">
            <van-swipe class="my-swipe" indicator-color="white" @change="onChange">
                <van-swipe-item v-for="(i, index) in swiper" :key="index">
                    <div class="pic"><img :src="checkPic(i)" alt="" class="bg" /></div>

                </van-swipe-item>
            </van-swipe>
            <div class="swipeChange">{{ index * 1 + 1 }}/{{ swiper.length }}</div>
            <div class="icon">
                <img :src="require('@/assets/shop/details/1.png')" alt="" class="left" @click="$router.go(-1)" />
                <div class="right">
                    <img v-if="collect == 1" :src="require('@/assets/shop/tallowed.png')" alt=""   @click="collection"/>
                    <img v-else :src="require('@/assets/shop/tno_allow.png')"  @click="collection" alt="" />
                  
                    <img :src="require('@/assets/shop/kefu.png')" alt="" @click="open" />
                </div>
            </div>
        </div>
        <div class="backTop" v-if="isShowBack" @click="backTop">
            <van-icon name="back-top" class="backTop_icon" />
        </div>
        <div class="proDesc">
            <div class="desc">
                <div class="top">
                    <div class="price">
                        <div class="new_price"><span>￥</span>{{ view.PRICE }}</div>
                        <div class="old_price" v-if="view.SHI_CHANG_PRICE > 0">
                            原价<span>￥{{ view.SHI_CHANG_PRICE }}</span>
                        </div>
    
                            <p  v-for="(k, index) in sortlist" :key="index"> {{k}}</p>
                
                    </div>
                      
                    <!-- <div class="allow"  @click="collection">

                        <img v-if="collect == 1" :src="require('@/assets/shop/details/allowed.png')" alt="" />
                        <img v-else :src="require('@/assets/shop/details/no_allow.png')" alt="" />
                        <span>收藏</span>
                    </div> -->
                </div>
                 <div  class="points">
                      购买此产品可获得 {{view.POINT}} 积分
                    ，可抵扣 {{view.HUI_DIAN}} 积分
                      
            </div>
                <div class="center">{{ view.NAME }}</div>
                <div class="bottom" ref="content">
                    <div class="content_description_content_position" :style="{ marginBottom: height_content == 1 ? '1.5rem' : '' }">
                        <div :class="[
                height_content >= 40
                  ? 'content_description_text'
                  : 'content_description_expansionText',
              ]" ref="content" v-html="htmlList(view.NAME2)"></div>
                        <!-- <div
              class="content_description_white"
              style="right: 0"
              v-if="height_content >= 40"
              @click.stop="height_content = 1"
            ></div> -->
                        <div class="content_description_blue" style="right: 0" v-if="height_content >= 40" @click.stop="height_content = 1">
                            <!-- 展开更多 -->
                            <img :src="require('@/assets/shop/details/arrow.png')" class="openmore" alt="" />
                            <!-- <van-icon name="arrow-down" color="#3A99E5" size="0.9rem" /> -->
                        </div>
                        <div class="content_detail_white" v-if="height_content == 1" @click.stop="height_content = 92">
                            <div>收起全文</div>
                            <img :src="require('@/assets/shop/details/arrow.png')" class="content_detail_white_img" alt="" />
                        </div>
                    </div>
                </div>
            </div>
            <!-- 2 -->
            <div class="area">
                <section  v-show="couponsInfo">
                    <div class="item" >
                        <span>优惠</span>
                        <div class="discount1">优惠券</div>
                        <div class="discount2"  > 
                            <span >{{ couponsInfo}}</span>
                        </div>
                    </div>
                    <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                </section>
                <section>
                    <div class="item">
                        <span>发货</span>
                        <div class="text">青岛直邮 -<span> 预计3-7工作日送达</span></div>
                    </div>
                    <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                </section>
                <section @click="showList = true">
                    <div class="item">
                        <span>送至</span>
                        <img :src="require('@/assets/shop/details/location.png')" class="location" alt="" />
                        <div class="text">{{currentContact?currentContact.address : '请选择地址'}}</div>
                    </div>
                    <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                </section>
                <section>
                    <div class="item">
                        <span>运费</span>
                        <div class="text">{{ yunfei[0]["NAME"] }}</div>
                    </div>
                    <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                </section>
            </div>
            <!-- 3 -->
            <div class="grade">
                  <div class="promise">
                <div class="content">
                    <div>商城承诺</div>
                    <div>所售商品均为正品，请放心选购！</div>
                </div>
            </div>
                <!-- <div class="title">
                    <div class="name">商品评价({{allcount}})</div>
                    <div class="moreall" @click="chakan( view.ID)">
                        <span>查看全部</span>
                        <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                    </div>
                </div> -->
                <!-- <div class="evl" v-for="(item, index) in pllist" :key="index">
                    <div class="head">
                        <img :src="user_face(item.USER_ID_PIC)" /> 
                        <div class="name">{{item.USER_ID_NAME}}</div>
                    </div>
                    <div class="contents">
                        {{item.CONTENT}}
                    </div>
                </div> -->
            </div>
          
          
        </div>
        <!-- 图片 -->
        <!-- <div class="proImg">
      <img
        v-for="(i, index) in swiper"
        :key="index"
        :src="checkPic(i)"
        alt=""
        class="showImg"
      /> -->
        <!-- :src="require('@/assets/shop/details/img' + (index * 1 + 1) + '.png')" -->

        <!-- </div> -->
  <van-divider :style="{ color: '#444', borderColor: '#bbb', padding: '0 130px' }">图文详情</van-divider>
        <div class="goodcontent" v-html="goodinfo">
        </div>
           <div class="grade">
                <div class="title">
                    <div class="name">商品评价({{allcount}})</div>
                    <div class="moreall" @click="chakan( view.ID)">
                        <span>查看全部</span>
                        <img :src="require('@/assets/shop/details/arrow.png')" class="more" alt="" />
                    </div>
                </div>
                <div class="evl" v-for="(item, index) in pllist" :key="index">
                    <div class="head">
                        <img :src="user_face(item.USER_ID_PIC)" /> 
                        <div class="name">{{item.USER_ID_NAME}}</div>
                    </div>
                    <div class="contents">
                        {{item.CONTENT}}
                    </div>
                </div>
            </div>

        <van-divider :style="{ color: '#444', borderColor: '#bbb', padding: '0 130px' }">推广文案
        </van-divider>
        <div class="vcode">
            <div class="code-text">{{inviteCode}}{{codeurl}}

            </div>

            <div id="copyUrl" class="copy-code-button" :data-clipboard-text="inviteCode+codeurl" @click="copy">一键复制</div>

        </div>
        <van-divider :style="{ color: '#444', borderColor: '#bbb', padding: '0 130px' }">看了又看
        </van-divider>

        <div class="other">
            <van-list v-model="loading" :finished="finished" finished-text="已经到底了" @load="onLoad">
                <div class="item" v-for="(k, index) in list" :key="index" @click="goDetails(k)">
                    <div class="img">
                        <img v-lazy="checkPic(k.PIC)" alt="" />
                        <!-- <span>新品</span> -->
                    </div>
                    <div class="desc">{{ k.NAME }}</div>
                    <section>
                        <div class="price">
                            <div class="new"><span>￥</span>{{ k.PRICE }}</div>
                            <div class="old"><span>￥</span>{{ k.SHI_CHANG_PRICE }}</div>
                        </div>
                        <!-- <div class="grade">96%好评</div> -->
                    </section>
                </div>
            </van-list>
        </div>

        <!-- <div class="none">已经到底了</div> -->

        <!-- 底部固定栏 -->
        <div class="footer">
            <div class="left">
                <div class="tab" @click="open">
                    <img :src="require('@/assets/shop/details/service.png')" alt="" />
                    <span>客服</span>
                </div>
                <!-- <van-badge :content="5" class="badge"> -->
                <van-badge class="badge">
                    <div class="tab" @click="collection"> 
                        <img v-if="collect == 1" :src="require('@/assets/shop/details/allowed.png')" alt="" />
                        <img v-else :src="require('@/assets/shop/details/allow.png')" alt="" />
                        <span >收藏</span>
                    </div>
                </van-badge>
                <van-badge :content="count" class="badge">
                    <div class="tab" @click="$router.push('/shop/car')">
                        <img :src="require('@/assets/shop/details/bag.png')" alt="" />
                        <span>购物车</span>
                    </div>
                </van-badge>
            </div>
            <div class="right">
                <p @click="goBuy">加入购物车</p>
                <p @click="goBuy">立即购买</p>
            </div>
        </div>

        <!-- 购买 -->
        <div class="shopDetais">
            <van-popup v-model="ShowSelectType" v-if="$store.state.detail2.proData.PRO" z-index="10" custom-style="height:80vh,width:100%"
                position="bottom">
                <div class="buy_content" v-for="(v, j) in guige" :key="j">
                    <div class="pro">
                        <img :src="checkPic($store.state.detail2.proData.PRO.PIC)" alt="" />
                        <div class="desc">
                            <div class="title">
                                {{ $store.state.detail2.proData.PRO.NAME }}
                            </div>
                            <div class="price">
                                ￥{{ $store.state.detail2.proData.PRO.PRICE }}
                            </div>
                        </div>
                    </div>
                    <div class="style">
                        <div class="title">选择{{ v.NAME }}</div>
                        <ul>
                            <li v-for="(k, i) in v.SUB" :key="i" :class="{ choice: $isEmpty(selectType, v.ID + '', 0) == k.ID }"
                                @click="changeType(v.ID, k.ID, i)">
                                {{ k.NAME }}
                            </li>
                        </ul>
                    </div>
                    <div class="num">
                        <div class="title">选择数量</div>
                        <van-stepper v-model="value" />
                    </div>
                    <div class="footers">
                        <p @click="AddToCard">加入购物车</p>
                        <p @click="goPay">立即购买</p>
                    </div>
                </div>
            </van-popup>
        </div>
        <!-- 弹窗开始 -->
        <div class="zg" v-show="isShow"></div>
        <div v-show="isShow" class="tc" @touchmove.prevent @mousewheel.prevent>
            <div class="ke">
                <div class="p">客服</div>
                <img class="wexin"  :src="require('@/assets/shop/WeChat.jpg')" alt="">
              
                <a href="tel:0532-87849393">
                    <div class="li">
                        <p class="tell">联系电话：0532-87849393</p>
                        <img :src="require('@/assets/shop/tell.png')" alt="">
                    </div>
                </a>
                <!-- <p class="add"><a href="tel:15020272559">联系电话：15020272559</a>
                    <img :src="require('@/assets/shop/tell.png')" alt="">
                </p> -->
            </div>
            <div class="close" @click="open">×</div>
        </div>
        <!-- 弹窗结束 -->
        <addressed :show="showList" @getMessage="changeShow" @getaddressId="getaddressId"></addressed>
    </div>
</template>
<script>
import "@/css/shop/details.scss";
import "@/css/shop/kefu.scss";
import { MessageBox, Toast } from "mint-ui";
import { mapState } from "vuex";
import Util from "../../util/common";
import addressed from "./address.vue"
import Clipboard from 'clipboard'
export default {
    //属性
    props: {
        viewBoolean: {
            type: null, //属性类型
            value: "",
            default: true,
        },
    },
    components: {
        addressed
    },
    data() {
        return {
            activeNames: [],
            index: 0,
            scrollTop: 0,
            isShowBack: false,
            show: false,
            couponsInfo : "",
            value: "",
            height_content: "",
            ShowSelectType: false,
            list: [],
            sortlist: [],
            listAddress: [],//地址
            loading: false,
            finished: false,
            pageNum: 0,
            showList: false,
            chosenAddressId: '',
            goodinfo: '',
            allcount: 0,
            collect: 0,
            collectimg: '',
            inviteCode: '',
            codeurl: '',
            pllist: [],
            kfShow: false,
            no: false,
            isShow: false
        };
    },

    mounted() {

        this.getdetailsList();
        this.pinglun();
        this.addressList();
        window.addEventListener("scroll", this.handleScroll, true);
        this.height_content =
            this.$refs.content == undefined ? "" : this.$refs.content.offsetHeight; //详情
    },
    watch: {
        scrollTop(val) {
            if (val > 375) {
                this.isShowBack = true;
            } else {
                this.isShowBack = false;
            }
        },
        '$route'(to, from) {
            // 获取最新的id 调用获取数据方法
            this.getdetailsList(this.$route.params.id)
        },
    },
    computed: mapState({
        view: (state) => state.detail.proData.PRO,
        yunfei: (state) => state.detail.proData.YUN_FEI,
        promotion: (state) => state.detail.proData.PROMOTION,
        detailsInfo: (state) => state.detail.proDetails,
        guige: (state) => state.detail2.proData.GUIGE,
        selectType: (state) => state.detail2.selectType,
        swiper() {
            //alert( this.$store.state.detail.proData.PRO.PICS);
            return this.$isEmpty(this.$store.state.detail.proData, "PICS", []);
        },
        htmlList: function () {
            return function (html) {
                var richtext = html;
                const regex = new RegExp(`<img src="`, "gi");

                if (html != "" && html != undefined) {
                    if (html.indexOf(`<img src="`) != -1) {
                        richtext = richtext.replace(regex, `<img style="width:100%" src="`);
                        return richtext;
                    } else {
                        return richtext;
                    }
                } else {
                    return "";
                }
            };
        },
        count() {
            return this.$store.state.detail.count;
        },
        currentContact() {
            const id = this.chosenAddressId;
            return id !== null ? this.listAddress.filter((item) => item.id === id)[0] : {};
        },
    }),
    methods: {
        open() {
          //  console.log(222)
            this.isShow = !this.isShow
        },
         chakan(k) {
               //pinglunlist
            this.$router.push({
                path: '/PingLun',
                query: {
                    to_id: k,
                }
            })
        },
        handleClick() {
            this.popupVisible = !this.popupVisible
        },
        copy() {
            var clipboard = new Clipboard('.copy-code-button') // 这里可以理解为选择器，选择上面的复制按钮
            clipboard.on('success', e => {
                Toast('复制成功')
                // 释放内存
                clipboard.destroy()
            })
            clipboard.on('error', e => {
                // 不支持复制
                Toast('手机权限不支持复制功能')
                // 释放内存
                clipboard.destroy()
            })
        },
        // swiper切换
        onChange(index) {
            this.index = index;
        },
        checkPic: function (picurl) {
            return this.$conf.domain + "/" + picurl;
        },
        changeShow(val) {
            this.showList = val
        },
        random() {
            return parseInt(Math.random() * (100 - 90 + 1) + 90, 10) + "%";
        },
        getaddressId(id) {
            this.chosenAddressId = id;
        },
        // 监听滚动
        handleScroll() {
            this.scrollTop =
                window.pageYOffset ||
                document.documentElement.scrollTop ||
                document.body.scrollTop;
        },
        user_face(url) {
            var index = url.indexOf("://")
            if (index == -1) {
                return this.domainUrl + '/' + url
            } else {
                return url
            }

        },
        // 返回顶部
        backTop() {
            window.scrollTo(0, 0);
        },
        pinglun() {
            this.$dopost(
                "/sysapi/comment/list/",
                {
                    page: 1,
                    to_id: this.$route.query.id,//25828 this.pageid
                    module: 5,
                },
                function (res) {
                    // console.log(res.data.data ,2566);
                    if (
                        res.data &&
                        typeof res.data.error != "undefined" &&
                        res.data.error === 0
                    ) {
                        //  console.log(res.data ,2566);
                        this.pllist = res.data.data;
                    } else {
                        Toast(res.data && res.data.mess ? res.data.mess : "接口错误");
                    }
                }.bind(this)
            );

        },
        // 加入购物车
        goBuy() {

            this.$store.commit("SET_DATAS2", this.detailsInfo);
          //  console.log(this.detailsInfo,12345)

            if (this.detailsInfo.DETAIL.GUIGE.hasOwnProperty("GUI_GE_1")) {
                this.ShowSelectType = true;
                this.value = this.$store.state.detail.carListIndex[this.detailsInfo.ID];
            } else {
                Util.IntoCarGlobal(this);
            }
        },
        // 收藏
        collection() {
              if (this.$store.state.login.token != 1) {
              this.$toast("请先登录会员！");
            //  return;
              this.$router.push({path:'/user'})
            }

            this.$dopost(
                "/sysapi/user/AddCollection/",
                {
                    c_id: this.$route.query.id,
                    api_user: this.$store.state.login.username,
                    type: 0,
                },
                function (res) {
                    if (
                        res.data &&
                        typeof res.data.error != "undefined" &&
                        res.data.error === 0
                    ) {
                        if (res.data.data.state == 0) {
                            this.collect = 1;
                        } else {
                            this.collect = 0;
                        }

                        // console.log(res.data.data,5487);
                        Toast(res.data && res.data.data.msg ? res.data.data.msg : "接口错误");


                    } else {
                        Toast(res.data && res.data.mess ? res.data.mess : "接口错误");
                    }
                }.bind(this)
            );
            //this.$store.dispatch('setDatas',{id:this.$route.query.id});


        },


        // 看了又看 跳转详情页
        goDetails(k) {
            this.$store.commit("GET_PRODETAILS", k);
            this.$router.push({ path: "/shop/details", query: { id: k.ID } });

        },
        changeType(typeID, ID, index) {
            this.$store.state.index.shopType = Number(index) + 1;
            this.$store.commit("CHANGE_COL_SELECTED2", [typeID, ID]);
            Util.IntoCarGlobal(this, true);
            this.$forceUpdate();
        },
        checkPic: function (picurl) {
            return this.$conf.domain + "/" + picurl;
        },
        // 详情
        getdetailsList() {

            this.$dopost(
                "/sysapi/pro/detail/",
                {
                    id: this.$route.query.id,
                    api_user: this.$store.state.login.username,
                },
                function (res) {
                    if (
                        res.data &&
                        typeof res.data.error != "undefined" &&
                        res.data.error === 0
                    ) {

                        this.collect = res.data.data.collectionType;
                        this.collectimg = res.data.data.PRO.PIC;
                        this.sortlist = res.data.data.sortlsit;
                        //console.log( window.location.href,477);
                        // console.log(res.data.data.PRO,898889);
                        this.goodinfo = res.data.data.PRO.MESS;
                        this.allcount = res.data.data.allcount;
                        this.couponsInfo = res.data.data.coupons.NAME;

                        this.inviteCode = res.data.data.PRO.Tcopy;
                        this.codeurl = window.location.href + '&u=' + this.$store.state.login.username;

                        this.$store.state.detail.selectType = {};
                        this.$store.commit("SET_DATAS", res.data.data);
                        if (
                            this.$store.state.index.currentPage.page != window.location.href
                        ) {
                            this.$store.state.index.currentPage.name = res.data.data.PRO.NAME;
                            this.picimg = res.data.data.PRO.PIC;
                            this.$store.state.index.currentPage.desc =
                                res.data.data.PRO.NAME2;
                            this.$store.state.index.currentPage.page = window.location.href;
                            this.$store.state.index.currentPage.image = Util.getNull(
                                res.data.data.PICS
                            )
                                ? this.$conf.domain + "/" + res.data.data.PICS[0]
                                : "";
                        }
                        //this.$forceUpdate();
                        //this.$set(this.$store.state.detail.proData.PRO, 'PICS', res.data.data.PRO.PICS);
                    } else {
                        Toast(res.data && res.data.mess ? res.data.mess : "接口错误");
                    }
                }.bind(this)
            );
            //this.$store.dispatch('setDatas',{id:this.$route.query.id});
        },
        // 地址列表
        addressList() {
            this.$dopost(
                "/sysapi/address/list/",
                {},
                function (response) {
                    if (
                        response.data &&
                        typeof response.data.error != "undefined" &&
                        response.data.error === 0
                    ) {
                        for (let k = 0; k < response.data.data.length; k++) {
                            let t = response.data.data[k];
                            this.listAddress.push({
                                id: t["ID"],
                                name: t["USER_NAME"],
                                isDefault: t["ISDEFAULT"],
                                area_id: t["QU"],
                                tel: t["USER_TEL"],
                                address: t["ADDRESS"],
                                lng: t["LNG"],
                                lat: t["LAT"],
                                address: t["ADDRESS"],
                            }); //t['SHENG_NAME']+t['SHI_NAME']+t['QU_NAME']+
                            if (t["ISDEFAULT"] == "1") this.chosenAddressId = t["ID"]; //this.list.length-1;

                        }
                    } else {
                        this.confirm = false;
                        Toast(
                            response.data && response.data.mess
                                ? response.data.mess
                                : "出错了！"
                        );
                    }
                }.bind(this),
                true
            );
        },
        // 其他产品展示
        onLoad() {
            //this.loading=true;
            this.$dopost(
                "/sysapi/pro/likeList/",
                {

                    page: this.pageNum + 1,
                    get_detail: 1,
                    viewloading: 0,
                    api_user: this.$store.state.login.username,
                },
                function (res) {
                    if (
                        res.data &&
                        typeof res.data.error != "undefined" &&
                        res.data.error === 0
                    ) {
                        console.log(res.data, 14785);
                        for (let i = 0; i < res.data.data.PRO.length; i++) {
                            this.list.push(res.data.data.PRO[i]);
                        }
                        this.pageNum = parseInt(res.data.data.page);
                        if (
                            parseInt(res.data.data.page) >= parseInt(res.data.data.allpage)
                        ) {
                            this.finished = true;
                        }
                        this.loading = false;
                    } else {
                        Toast(res.data && res.data.mess ? res.data.mess : "接口错误");
                    }
                }.bind(this)
            );
        },
        // 弹框加入购物车
        AddToCard() {
            Util.IntoCarGlobal(this, false, this.value);
        },
        // 立即购买
        //点击跳转到支付页
        goPay() {
            this.addIntoCar("", false);
            // if (this.$store.state.login.token != 1) {
            //   this.$toast("请先登录会员！");
            //   return;
            //   //this.$router.push({path:'/login'})
            // }
            // // 如果有选择商品才能跳转
            // if (this.$store.getters.selectedList.length) {
            //   // 保存+缓存选择的商品 ,在支付页能用到
            //   this.$store.dispatch("setSelectedList");
            //   this.$router.push({ path: "/shop/buy" });
            // } else {
            //   alert("你还没选择商品");
            // }
        },

        addIntoCar() {
            var onlyChangePrice = arguments[1] ? arguments[1] : false;
            var proParaCheck = true;
            Object.keys(this.$store.state.detail2.selectType).forEach(
                function (key) {
                    if (
                        !this.$store.state.detail2.selectType[key] ||
                        parseInt(this.$store.state.detail2.selectType[key]) <= 0
                    ) {
                        if (!onlyChangePrice) Toast({ message: "请选择完整的产品属性" });
                        proParaCheck = false;
                    }
                }.bind(this)
            );
            var typeId = 0;
            var typeIdBool = true;
            // console.log(proParaCheck,this.$isEmptyObject(this.$store.state.detail.proData.GUIGE));
            if (
                proParaCheck &&
                this.$isEmptyObject(this.$store.state.detail.proData.GUIGE) == false
            ) {
                Object.keys(this.$store.state.detail.proData.TYPE).forEach(
                    function (key) {
                        let jiekou = this.$store.state.detail.proData.TYPE[key][
                            "GUI_GE_JSON"
                        ];
                        jiekou = JSON.parse(jiekou);

                        typeIdBool = true; //console.log('----type:'+this.$store.state.detail.proData.TYPE[key]['GUI_GE_JSON']);
                        for (let k in jiekou) {
                            typeIdBool =
                                typeIdBool &&
                                jiekou[k] == this.$store.state.detail2.selectType[k];
                            console.log(jiekou[k], this.$store.state.detail2.selectType[k]);
                        }
                        if (typeIdBool == true)
                            typeId = this.$store.state.detail.proData.TYPE[key];
                        //console.log(typeId);
                    }.bind(this)
                );

                if (typeId == 0) {
                    if (!onlyChangePrice) Toast({ message: "该产品属性无价格设置" });
                    return;
                }
            }
            if (this.$store.state.detail.proData.GUIGE.length == 0)
                typeId = this.$store.state.detail.proData.TYPE[0];
            if (onlyChangePrice) {
                this.$store.state.detail.proData.PRO.PRICE = typeId["PRICE"];
                this.$store.state.detail.proData.PRO.HUI_DIAN = typeId["HUI_DIAN"];
                this.$store.state.detail.proData.PRO.POINT = typeId["POINT"];
                return;
            }
            //  mint-ui的弹出式提示框
            const product = [
                {
                    title: this.view.NAME,
                    price: this.view.PRICE,
                    id: this.view.ID,
                    count: this.value || 1,
                    promotion: this.$store.state.detail.proData.PROMOTION,
                    yunfei: this.$store.state.detail.proData.YUN_FEI,
                    // promotion_id:5,
                    type: JSON.parse(JSON.stringify(typeId)),
                    imgPath:
                        this.$conf.domain + "/" + this.$store.state.detail.proData.PRO.PIC,
                    choseBool: true,
                    couponsInfo:this.couponsInfo,
                },
            ];
            // console.log(product)
            if (proParaCheck) {
                if (typeId.length == 0) {
                    Toast({
                        message: "产品属性错误",
                        duration: 2000,
                    });
                } else {
                    this.$store.commit("BUY_SOME", product);
                    this.$router.push({ path: "/shop/buy", query: { type: 2 } });
                    // this.$store.dispatch("addCarList", product);
                    // this.$store.dispatch("setLocalCount", true);
                    // Toast({
                    //   message: "添加成功",
                    //   duration: 2000,
                    // });
                }
            }
        },
    },
};
</script>
